/* OnDemandFetcher - Decompiled by JODE
 * Visit http://jode.sourceforge.net/
 */
import java.awt.Graphics;

public class OnDemandFetcher implements Runnable {
	public static JString aClass3_1195;
	public static Class57 aClass57_1196;
	public static Class7 aClass7_1197;
	public static int anInt1198;
	public static JString aClass3_1199 = Class39_Sub5_Sub9.createJString(114, "Loaded title screen");
	public static JString aClass3_1200;
	public static int[] anIntArray1201;
	public static int[] anIntArray1202;
	public static int anInt1203;
	public static JString aClass3_1204;
	public static int anInt1205;
	public static Class46 aClass46_1206;
	public static JString aClass3_1207;
	public static RSSocket aClass16_1208;
	public static JString aClass3_1209;
	public static int anInt1210;
	public static int anInt1211;

	public static void method1116(int i, byte i_0_, int i_1_, int i_2_, int i_3_) {
		for (int i_4_ = i_1_; i_1_ + i_3_ >= i_4_; i_4_++) {
			for (int i_5_ = i; i_5_ <= i + i_2_; i_5_++) {
				if (i_5_ >= 0 && i_5_ < 104 && i_4_ >= 0 && i_4_ < 104) {
					Class39_Sub5_Sub1.aByteArrayArrayArray1671[0][i_5_][i_4_] = (byte) 127;
					if (i_5_ == i && i_5_ > 0)
						Class67.anIntArrayArrayArray1175[0][i_5_][i_4_] = (Class67.anIntArrayArrayArray1175[0][i_5_ - 1][i_4_]);
					if (i + i_2_ == i_5_ && i_5_ < 103)
						Class67.anIntArrayArrayArray1175[0][i_5_][i_4_] = (Class67.anIntArrayArrayArray1175[0][i_5_ + 1][i_4_]);
					if (i_1_ == i_4_ && i_4_ > 0)
						Class67.anIntArrayArrayArray1175[0][i_5_][i_4_] = (Class67.anIntArrayArrayArray1175[0][i_5_][i_4_ - 1]);
					if (i_3_ + i_1_ == i_4_ && i_4_ < 103)
						Class67.anIntArrayArrayArray1175[0][i_5_][i_4_] = (Class67.anIntArrayArrayArray1175[0][i_5_][i_4_ + 1]);
				}
			}
		}
	}

	public void run() {
		try {
			for (;;) {
				Class39_Sub9 class39_sub9;
				synchronized (RSSocket.aClass49_304) {
					class39_sub9 = (Class39_Sub9) RSSocket.aClass49_304.method969(false);
				}
				if (class39_sub9 != null) {
					if (class39_sub9.anInt1410 != 0) {
						if (class39_sub9.anInt1410 == 1) {
							class39_sub9.aByteArray1404 = (class39_sub9.aClass6_1409.readFile(-59, (int) class39_sub9.hash));
							synchronized (RSSocket.aClass49_304) {
								Class19.aClass49_365.method956(class39_sub9);
							}
						}
					} else {
						class39_sub9.aClass6_1409.writeFile(-1, class39_sub9.aByteArray1404, (int) class39_sub9.hash, class39_sub9.aByteArray1404.length);
						synchronized (RSSocket.aClass49_304) {
							class39_sub9.unlink();
						}
					}
					synchronized (Class4.anObject61) {
						if (Class23.anInt433 <= 1) {
							Class23.anInt433 = 0;
							Class4.anObject61.notifyAll();
							break;
						}
						Class23.anInt433 = 600;
					}
				} else {
					Class45.method917(3, 100L);
					synchronized (Class4.anObject61) {
						if (Class23.anInt433 <= 1) {
							Class23.anInt433 = 0;
							Class4.anObject61.notifyAll();
							break;
						}
						Class23.anInt433--;
					}
				}
			}
		} catch (Exception exception) {
			Class39_Sub7.method849(exception, 64, null);
		}
	}

	public static void method1117(int i) {
		aClass3_1204 = null;
		aClass3_1200 = null;
		aClass7_1197 = null;
		aClass57_1196 = null;
		aClass3_1207 = null;
		aClass16_1208 = null;
		aClass3_1195 = null;
		aClass46_1206 = null;
		anIntArray1201 = null;
		aClass3_1209 = null;
		aClass3_1199 = null;
		anIntArray1202 = null;
	}

	public static void method1118(CacheArchive class9_sub1, byte i, CacheIO class6, int i_6_) {
		byte[] is = null;
		synchronized (RSSocket.aClass49_304) {
			for (Class39_Sub9 class39_sub9 = (Class39_Sub9) RSSocket.aClass49_304.method969(false); class39_sub9 != null; class39_sub9 = ((Class39_Sub9) RSSocket.aClass49_304.method963((byte) -87))) {
				if (class39_sub9.hash == (long) i_6_ && class39_sub9.aClass6_1409 == class6 && class39_sub9.anInt1410 == 0) {
					is = class39_sub9.aByteArray1404;
					break;
				}
			}
		}
		if (is != null)
			class9_sub1.method173(is, i_6_, true, class6, (byte) -80);
		else {
			byte[] is_7_ = class6.readFile(-98, i_6_);
			class9_sub1.method173(is_7_, i_6_, true, class6, (byte) -80);
		}
	}

	public static void drawBottomChatOptions(int i, int i_8_, TextRenderer class39_sub5_sub10_sub1, int i_9_, int i_10_) {
		if (i_9_ == 41) {
			Class39_Sub5_Sub18.aClass57_2130.method1006(i_9_ ^ 0x23);
			Tile.aClass39_Sub5_Sub10_Sub4_1909.method695(0, 0);
			class39_sub5_sub10_sub1.method636(Class39_Sub5_Sub9.aClass3_1803, 55, 28, 16777215, true);
			if (i_8_ == 0)
				class39_sub5_sub10_sub1.method636(Class57_Sub2.aClass3_1574, 55, 41, 65280, true);
			if (i_8_ == 1)
				class39_sub5_sub10_sub1.method636(Class35.aClass3_624, 55, 41, 16776960, true);
			if (i_8_ == 2)
				class39_sub5_sub10_sub1.method636(Class46.aClass3_881, 55, 41, 16711680, true);
			if (i_8_ == 3)
				class39_sub5_sub10_sub1.method636(Class39_Sub4.aClass3_1328, 55, 41, 65535, true);
			class39_sub5_sub10_sub1.method636(Class32.aClass3_577, 184, 28, 16777215, true);
			if (i_10_ == 0)
				class39_sub5_sub10_sub1.method636(Class57_Sub2.aClass3_1574, 184, 41, 65280, true);
			if (i_10_ == 1)
				class39_sub5_sub10_sub1.method636(Class35.aClass3_624, 184, 41, 16776960, true);
			if (i_10_ == 2)
				class39_sub5_sub10_sub1.method636(Class46.aClass3_881, 184, 41, 16711680, true);
			class39_sub5_sub10_sub1.method636(PacketParser.aClass3_1049, 324, 28, 16777215, true);
			if (i == 0)
				class39_sub5_sub10_sub1.method636(Class57_Sub2.aClass3_1574, 324, 41, 65280, true);
			if (i == 1)
				class39_sub5_sub10_sub1.method636(Class35.aClass3_624, 324, 41, 16776960, true);
			if (i == 2)
				class39_sub5_sub10_sub1.method636(Class46.aClass3_881, 324, 41, 16711680, true);
			class39_sub5_sub10_sub1.method625(Class34.aClass3_608, 417, 17, 85, 25, 16777215, true, 1, 1, 0);
			try {
				Graphics graphics = Class41.aCanvas778.getGraphics();
				Class39_Sub5_Sub18.aClass57_2130.method1010(-64, graphics, 0, 453);
			} catch (Exception exception) {
				Class41.aCanvas778.repaint();
			}
		}
	}

	public static Class39_Sub5_Sub13 method1120(int i, int i_11_) {
		Class39_Sub5_Sub13 class39_sub5_sub13 = ((Class39_Sub5_Sub13) Class39_Sub5_Sub11.aClass7_1844.method133((byte) 125, (long) i_11_));
		if (class39_sub5_sub13 != null)
			return class39_sub5_sub13;
		byte[] is = Class39_Sub5_Sub8.aClass9_1795.method165(30605, 9, i_11_);
		class39_sub5_sub13 = new Class39_Sub5_Sub13();
		class39_sub5_sub13.anInt1874 = i_11_;
		if (is != null)
			class39_sub5_sub13.method720(false, new Stream(is));
		class39_sub5_sub13.method724((byte) 93);
		Class39_Sub5_Sub11.aClass7_1844.method135(class39_sub5_sub13, (long) i_11_, (byte) 104);
		return class39_sub5_sub13;
	}

	public static void method1121(int i) {
		Class14.aClass19_213 = new Class19(32);
	}

	static {
		aClass3_1195 = aClass3_1199;
		aClass3_1200 = Class39_Sub5_Sub9.createJString(103, "sideicons");
		aClass7_1197 = new Class7(100);
		anIntArray1201 = new int[50];
		anInt1203 = 0;
		anInt1205 = -1;
		anInt1210 = 0;
		aClass3_1207 = Class39_Sub5_Sub9.createJString(106, "mapedge");
		aClass3_1209 = Class39_Sub5_Sub9.createJString(125, "Anmelde)2Limit -Uberschritten)3");
		anInt1211 = 1;
		aClass3_1204 = Class39_Sub5_Sub9.createJString(111, ":  ");
	}
}
